package com.power.sifa.info.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  法律发布机关实体类
*/

@Entity
@ApiModel(value="法律发布机关")
@Data
@Table(name="Law_pubunit",schema="sfapprove")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Law_pubunit.Law_pubunitPK.class) 用于复合组件
public class Law_pubunit extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "机关编码")
    private String id;

    @Column(nullable = false)
    @ApiModelProperty(value = "机关名称")
    private String name;

    @ApiModelProperty(value = "区域编码")
    private String adid;

    @ApiModelProperty(value = "类型")
    private Integer type;

    @Column(nullable = false)
    @ApiModelProperty(value = "删除标记")
    private Integer deleted;

    /**
     *  类型文本
     */
    @Transient
    @FieldEnumText(eum="Tp_unit", valuefield="type")
    private String type_text;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("name", this.getName());
        map.put("adid", this.getAdid());
        map.put("type_text", this.type_text);
        map.put("type", this.getType());
        map.put("deleted", this.getDeleted());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Law_pubunitPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Law_pubunitPK pk = (Law_pubunitPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}